// load data
use data/main_file.dta, clear

// erase previous version of table
cap erase tabs/T03.tex
cap erase tabs/T03.txt

// create table 3
reghdfe Chavismo i.HCR##i.visited 											/// 
		i.HCR##i.focal 														///
		i.HCR##c.log_den i.HCR##c.log_pov									///
		i.HCR##c.baseline_ch i.HCR#c.sh_urbano [aw = log_pop],				///
		vce(cluster loc) absorb(loc i.edo##i.year)		
outreg2 using tabs/T03.tex, append 											///
		keep(1.HCR#1.visited 1.HCR#1.focal 1.HCR#1.visited#1.focal)			///
		addtext(Covariates, Yes, State-Election FE, Yes, Parish FE, Yes) 	
		
reghdfe Chavismo i.HCR##i.visited##i.focal									///
		i.HCR##c.log_den i.HCR##c.log_pov									///
		i.HCR##c.baseline_ch i.HCR#c.sh_urbano [aw = log_pop],				///
		vce(cluster loc) absorb(loc i.edo##i.year)	
outreg2 using tabs/T03.tex, append 											///
		keep(1.HCR#1.visited 1.HCR#1.focal 1.HCR#1.visited#1.focal)			///
		addtext(Covariates, Yes, State-Election FE, Yes, Parish FE, Yes) 				
		
foreach v of varlist visited_chavez opo_gob {								// 
	reghdfe Chavismo i.HCR##i.visited##i.focal								///
		i.HCR##i.visited##i.`v' 											///
		i.HCR##c.log_den i.HCR##c.log_pov									///
		i.HCR##c.baseline_ch i.HCR#c.sh_urbano [aw = log_pop],				///
		vce(cluster loc) absorb(loc i.edo##i.year)							
	outreg2 using tabs/T03.tex, append 										///
		keep(1.HCR#1.visited 1.HCR#1.focal 1.HCR#1.visited#1.focal 			///
			1.HCR#1.`v' 1.HCR#1.visited#1.`v')								///
			addtext(Covariates, Yes, State-Election FE, Yes, Parish FE, Yes) 				
}	

reghdfe Chavismo i.HCR##i.visited##i.focal									///
		i.HCR##i.visited##i.visited_chavez 									///
		i.HCR##i.visited##i.opo_gob 										///
		i.HCR##c.log_den i.HCR##c.log_pov									///
		i.HCR##c.baseline_ch i.HCR#c.sh_urbano [aw = log_pop],				///
		vce(cluster loc) absorb(loc i.edo##i.year)	
outreg2 using tabs/T03.tex, append 											///
		keep(1.HCR#1.visited 1.HCR#1.focal 1.HCR#1.visited#1.focal			///
		1.HCR#1.visited_chavez 1.HCR#1.visited#1.visited_chavez				///
		1.HCR#1.opo_gob 1.HCR#1.visited#1.opo_gob)							///
		addtext(Covariates, Yes, State-Election FE, Yes, Parish FE, Yes) 	
